/**
 * Created by WebStorm.
 * User: NiRongxu
 * Date: 2022/3/19
 * Description: 文件描述
 */
import {RouteRecordRaw, createRouter, createWebHashHistory} from 'vue-router'

import en from '../i18n/lang/en.js'

import CommonViews from '@/views/CommonViews.vue'
import Login from '@/views/login/index.vue'
import Layout from '@/views/layout/layout.vue'
import HomeMain from '@/views/index/index.vue'

// 不是必须加载的组件使用懒加载
const electricityPanda = () => import('@/views/electricityPanda/index.vue')
const electricityPandaorderList = () => import('@/views/electricityPanda/orderList.vue')
const driverExamine = () => import('@/views/driverExamine/driverExamine.vue')
// const Icon = () => import('@/views/icon/index.vue')
// const Erji = () => import('@/views/duoji/erji.vue')
// const Erji2 = () => import('@/views/duoji/erji2.vue')
// const Sanji = () => import('@/views/duoji/sanji.vue')
// const Sanji2 = () => import('@/views/duoji/sanji2.vue')
// const Siji = () => import('@/views/duoji/siji.vue')
// const Wuji = () => import('@/views/duoji/wuji.vue')
// const Transfer = () => import('@/views/transfer/transfer.vue')
// const DragTable = () => import('@/views/table/dragTabe.vue')
// const Upload = () => import('@/views/upload/upload.vue')
const editorView = () => import('@/views/editor/editorView.vue')
const NotFound = () => import('@/views/page404.vue')
// const NavClassify = () => import('@/views/syssetting/navClassify.vue')
// const pagePermissions = () => import('@/views/permissions/pagePermissions.vue')
// const btnPermissions = () => import('@/views/permissions/btnPermissions.vue')


//运营中心------订单管理
const orderManage = () => import('@/views/operationManage/order/orderManage.vue')
//运营中心------设备管理
const equipmentManage = () => import('@/views/operationManage/equipment/equipmentManage.vue')
//运营中心------内容管理
const contentManage = () => import('@/views/operationManage/contentManage/contentManage.vue')
//运营中心------卡券管理
const cardCouponManage = () => import('@/views/operationManage/cardCouponManage/cardCouponManage.vue')
//运营中心------补电站管理
const powerSupplementManage = () => import('@/views/operationManage/powerSupplementManage/powerSupplementManage.vue')
//运营中心------换电管理
const electricBindManage = () => import('@/views/operationManage/electricBindManage/electricBindManage.vue')
//运营中心------票券管理
const couponManage = () => import('@/views/operationManage/couponManage/couponManage.vue')
//运营中心------司机换电结算
const driverComputeManage = () => import('@/views/operationManage/driverComputeManage/driverComputeManage.vue')
//运营中心------司机结算管理
const workerComputeManage = () => import('@/views/operationManage/workerComputeManage/workerComputeManage.vue')
//运营中心------站点结算管理
const stationComputeManage = () => import('@/views/operationManage/stationComputeManage/stationComputeManage.vue')
//运营中心------车辆管理
const carManage = () => import('@/views/operationManage/carManage/carManage.vue')
//运营中心------投诉管理
const complaintManage = () => import('@/views/operationManage/complaintManage/complaintManage.vue')


//用户及司机管理-----审核管理
const examineManage = () => import('@/views/driverAnduser/driver/examineManage.vue')
//用户及司机管理-----司机管理
const driverManage = () => import('@/views/driverAnduser/driver/driverManage.vue')
//用户及司机管理-----用户管理
const userManage = () => import('@/views/driverAnduser/user/userManage.vue')

//数据统计---运营数据---用户数据分析
const userAalysis = () => import('@/views/statistics/operationStatistics/userAalysis.vue')
//数据统计---运营数据---营收数据分析
const revenueaAalysis = () => import('@/views/statistics/operationStatistics/revenueaAalysis.vue')
//数据统计---运营数据---司机数据分析
const driverAalysis = () => import('@/views/statistics/operationStatistics/driverAalysis.vue')
//数据统计---运营数据---活动数据分析
const activityAalysis = () => import('@/views/statistics/operationStatistics/activityAalysis.vue')

//数据统计--榜单数据统计
const listStatistics = () => import('@/views/statistics/listStatistics/listStatistics.vue')
//数据统计--榜单数据统计
const cardCouponStatistics = () => import('@/views/statistics/cardCouponStatistics/cardCouponStatistics.vue')
//数据统计--榜单数据统计
const zoneData = () => import('@/views/statistics/zoneData/zoneData.vue')
//角色管理
const roleManageMent = () => import('@/views/userManagement/roleManageMent.vue')
//员工管理
const staffManageMent = () => import('@/views/userManagement/index.vue')
//客服管理
const serviceManageMent = () => import('@/views/roleManageMent/serviceManageMent.vue')
//站点管理
const siteManageMent = () => import('@/views/roleManageMent/siteManageMent.vue')
//运营管理
const operationsManageMent = () => import('@/views/roleManageMent/operationsManageMent.vue')
//司机管理
const driverManageMent = () => import('@/views/roleManageMent/driverManageMent.vue')
//车辆管理
const carManageMent = () => import('@/views/roleManageMent/carManageMent.vue')
//车辆管理
const deviceManageMent = () => import('@/views/roleManageMent/deviceManageMent.vue')
//车辆管理
const financeManageMent = () => import('@/views/roleManageMent/financeManageMent.vue')

//系统设置
const menuConfig = () => import('@/views/system/menuConfig/index.vue')


const routeName = en.routeName

export type IRouter = {
    hidden?: boolean
    iconCls?: string
    alone?: boolean
    children: Array<IRouter>
} & RouteRecordRaw

const defaultRouter: Array<IRouter> = [
    {path: '/', redirect: '/index', hidden: true, children: []},
    {
        path: '/login',
        component: Login,
        name: '',
        hidden: true,
        children: [],
    },
    {
        path: '/index',
        iconCls: 'fa fa-home',
        name: routeName.home,
        component: Layout,
        alone: true,
        children: [
            {
                path: '/index',
                // iconCls: 'fa fa-dashboard',
                name: routeName.home,
                component: HomeMain,
                children: [],
            },
        ],
    },

    {
        path: '/404',
        component: NotFound,
        name: '404',
        hidden: true,
        children: [],
    },

]

const addRouter = [
    // {
    //   path: '/',
    //   iconCls: 'fa fa-paw',
    //   name: routeName.electricityPanda,
    //   component: Layout,
    //   children: [
    //     {
    //       path: '/pandaIndex',
    //       iconCls: 'fa fa-life-ring',
    //       name: routeName.driverSys,
    //       component: electricityPanda,
    //       children: [],
    //     },
    //     {
    //       path: '/orderList',
    //       iconCls: 'fa fa-life-ring',
    //       name: routeName.pandaOrderList,
    //       component: electricityPandaorderList,
    //       children: [],
    //     },
    //     {
    //       path: '/driverExamine',
    //       iconCls: 'fa fa-life-ring',
    //       name: routeName.driverExamine,
    //       component: driverExamine,
    //       children: [],
    //     },
    //   ],
    // },
    {
        //角色管理
        path: '/userManagement',
        iconCls: 'fa fa-desktop',
        meta: {role: ['userManagement']},
        name: routeName.roleManageMent1,
        component: Layout,
        children: [{
            //客服管理
            path: '/serviceManageMent',
            iconCls: 'fa fa-user-circle-o',
            meta: {role: ['serviceManageMent']},
            name: routeName.serviceManageMent, //客服管理
            component: serviceManageMent,
            children: []
        }, {
            //站点管理
            path: '/siteManageMent',
            iconCls: 'fa fa-map-marker',
            meta: {role: ['siteManageMent']},
            name: routeName.siteManageMent,
            component: siteManageMent,
            children: []
        }, {
            //运营管理
            path: '/operationsManageMent',
            iconCls: 'fa fa-exchange',
            meta: {role: ['operationsManageMent']},
            name: routeName.operationsManageMent,
            component: operationsManageMent,
            children: []
        }, {
            //司机管理
            path: '/driverManageMent',
            iconCls: 'fa fa-address-card-o',
            meta: {role: ['driverManageMent']},
            name: routeName.driverManageMent,
            component: driverManageMent,
            children: []
        }, {
            //车辆管理
            path: '/carManageMent',
            iconCls: 'fa fa-taxi',
            meta: {role: ['carManageMent']},
            name: routeName.carManageMent,
            component: carManageMent,
            children: []
        }, {
            //设备管理
            path: '/deviceManageMent',
            iconCls: 'fa fa-server',
            meta: {role: ['deviceManageMent']},
            name: routeName.deviceManageMent,
            component: deviceManageMent,
            children: []
        }, {
            //财务管理
            path: '/financeManageMent',
            iconCls: 'fa fa-usd',
            meta: {role: ['financeManageMent']},
            name: routeName.financeManageMent,
            component: financeManageMent,
            children: []
        },]
    },
    {
        // 运营管理
        path: '/operationManage',
        iconCls: 'fa fa-desktop',
        meta: {role: ['operationManage']},
        name: routeName.operationManage,
        component: Layout,
        children: [
            {
                //订单管理
                path: '/orderManage',
                meta: {role: ['orderManage']},
                iconCls: 'fa fa-print',
                name: routeName.orderManage,
                component: orderManage,
                children: [],
            },
            {
                //设备管理
                path: '/equipmentManage',
                meta: {role: ['equipmentManage']},
                iconCls: 'fa fa-wrench',
                name: routeName.equipmentManage,
                component: equipmentManage,
                children: [],
            },
            {
                //内容管理
                path: '/contentManage',
                meta: {role: ['contentManage']},
                iconCls: 'fa fa-dashboard',
                name: routeName.contentManage,
                component: contentManage,
                children: [],
            },
            //   {
            //     //卡券管理
            //     path: '/cardCouponManage',
            //     meta: {role: ['cardCouponManage']},
            //     iconCls: 'fa fa-credit-card-alt',
            //     name: routeName.cardCouponManage,
            //     component: cardCouponManage,
            //     children: []
            // },
            {
                //补电站管理
                path: '/powerSupplementManage',
                meta: {role: ['powerSupplementManage']},
                iconCls: 'fa fa-life-ring',
                name: routeName.powerSupplementManage,
                component: powerSupplementManage,
                children: []
            },
            {
                //换电管理
                path: '/electricBindManage',
                meta: {role: ['electricBindManage']},
                iconCls: 'fa fa-battery-quarter',
                name: routeName.electricBindManage,
                component: electricBindManage,
                children: []
            },
            {
                //票券管理
                path: '/couponManage',
                meta: {role: ['couponManage']},
                iconCls: 'fa fa-ticket',
                name: routeName.couponManage,
                component: couponManage,
                children: []
            },
            {
                //司机换电结算
                path: '/driverComputeManage',
                meta: {role: ['driverComputeManage']},
                iconCls: 'fa fa-road',
                name: routeName.driverComputeManage,
                component: driverComputeManage,
                children: []
            },
            {
                //司机结算管理
                path: '/workerComputeManage',
                meta: {role: ['workerComputeManage']},
                iconCls: 'fa fa-road',
                name: routeName.workerComputeManage,
                component: workerComputeManage,
                children: []
            },
            {
                //站点结算管理
                path: '/stationComputeManage',
                meta: {role: ['stationComputeManage']},
                iconCls: 'fa fa-font-awesome',
                name: routeName.stationComputeManage,
                component: stationComputeManage,
                children: []
            },
            {
                //车辆管理
                path: '/carManage',
                meta: {role: ['carManage']},
                iconCls: 'fa fa-truck',
                name: routeName.carManage,
                component: carManage,
                children: []
            },
            {
                //投诉管理
                path: '/complaintManage',
                meta: {role: ['complaintManage']},
                iconCls: 'fa fa-bullhorn',
                name: routeName.complaintManage,
                component: complaintManage,
                children: []
            },

        ],
    },
    {
        // 用户及司机管理
        path: '/driverAndUser',
        iconCls: 'fa fa-group',
        meta: {role: ['driverAndUser']},
        name: routeName.driverAndUser,
        component: Layout,
        children: [
            {
                path: '/examineManage',
                meta: {role: ["examineManage"]},
                iconCls: 'fa fa-glass',
                name: routeName.examineManage,
                component: examineManage,
                children: [],
            },
            {
                path: '/driver',
                iconCls: 'fa fa-user-md',
                meta: {role: ['driver']},
                name: routeName.driverManage,
                component: driverManage,
                children: [],
            },
            {
                path: '/userManage',
                iconCls: 'fa fa-user',
                meta: {role: ['userManage']},
                name: routeName.userManage,
                component: userManage,
                children: [],
            },
        ],
    },
    {
        // 数据统计
        path: '/statistics',
        iconCls: 'fa fa-bar-chart',
        meta: {role: ['statistics']},
        name: routeName.statistics,
        component: Layout,
        children: [
            {
                //用户数据分析
                path: '/userAalysis',
                iconCls: 'fa fa-user-circle',
                meta: {role: ['userAalysis']},
                name: routeName.userAalysis,
                component: userAalysis,
                children: [],
            },
            {
                //营收数据分析
                path: '/revenueaAalysis',
                meta: {role: ['revenueaAalysis']},
                iconCls: 'fa fa-jpy',
                name: routeName.revenueaAalysis,
                component: revenueaAalysis,
                children: [],
            },
            {
                //司机数据统计
                path: '/driverAalysis',
                meta: {role: ['driverAalysis']},
                iconCls: 'fa fa-id-card-o',
                name: routeName.driverAalysis,
                component: driverAalysis,
                children: [],
            },
            {
                //活动数据统计
                path: '/activityAalysis',
                meta: {role: ['activityAalysis']},
                iconCls: 'fa fa-gift',
                name: routeName.activityAalysis,
                component: activityAalysis,
                children: [],
            },
            {
                //区域热力数据
                path: '/zoneData',
                iconCls: 'fa fa-area-chart',
                meta: {role: ['zoneData']},
                name: routeName.zoneData,
                component: zoneData,
                children: [],
            },
            {
                //卡券数据统计
                path: '/cardCouponStatistics',
                iconCls: 'fa fa-ticket',
                meta: {role: ['cardCouponStatistics']},
                name: routeName.cardCouponStatistics,
                component: cardCouponStatistics,
                children: [],
            },
            {
                //榜单数据统计
                path: '/listStatistics',
                meta: {role: ['listStatistics']},
                iconCls: 'fa fa-list-alt',
                name: routeName.listStatistics,
                component: listStatistics,
                children: [],
            },
        ],
    },
    {
        //权限管理
        path: '/userManagement',
        iconCls: 'fa fa-desktop',
        meta: {role: ['userManagement']},
        name: routeName.authManageMent,
        component: Layout,
        children: [{
            //角色管理
            path: '/roleManageMent',
            iconCls: 'fa fa-address-book-o',
            meta: {role: ['roleManageMent']},
            name: routeName.roleManageMent,
            component: roleManageMent,
            children: []
        }, {
            //员工管理
            path: '/staffIndex',
            iconCls: 'fa fa-user-o',
            meta: {role: ['staffIndex']},
            name: routeName.staffManageMent,
            component: staffManageMent,
            children: []
        }, {
            //test2
            path: '/staffIndex',
            iconCls: 'fa fa-user-o',
            meta: {role: ['staffIndex']},
            name: routeName.test2,
            component: staffManageMent,
            children: []
        }]
    },
    {
        // 系统设置
        path: '/system',
        iconCls: 'fa fa-cube',
        name: routeName.system,
        meta: {role: ['system']},
        component: Layout,
        children: [
            {
                path: '/system/menuConfig/index',
                meta: {role: ['menuConfig']},
                iconCls: 'fa fa-file-text-o',
                name: routeName.menuConfig,
                component: menuConfig,
                children: [],
            },
        ],
    },
    {
        // 景点信息管理
        path: '/system',
        iconCls: 'fa fa-cube',
        name: routeName.scenicSpotManageMent,
        meta: {role: ['system']},
        component: Layout,
        children: [
            {
                path: '/system/menuConfig/index',
                meta: {role: ['menuConfig']},
                iconCls: 'fa fa-file-text-o',
                name: routeName.scenicSpotNotice,
                component: menuConfig,
                children: [],
            },
        ],
    },
    // {
    //   path: '/',
    //   iconCls: 'fa fa-paw',
    //   name: routeName.icon,
    //   component: Layout,
    //   children: [
    //     {
    //       path: '/icon',
    //       iconCls: 'fa fa-life-ring',
    //       name: routeName.builtInIcon,
    //       component: Icon,
    //       children: []
    //     }
    //   ]
    // },
    // {
    //   path: '/',
    //   iconCls: 'fa fa-exchange',
    //   name: routeName.shuttleBox,
    //   component: Layout,
    //   children: [
    //     {
    //       path: '/transfer',
    //       iconCls: 'fa fa-sign-in',
    //       name: routeName.demoShuttle,
    //       component: Transfer,
    //       children: []
    //     }
    //   ]
    // },
    // {
    //   path: '/',
    //   iconCls: 'fa fa-universal-access',
    //   name: routeName.permissions,
    //   component: Layout,
    //   children: [
    //     {
    //       path: '/pagePermissions',
    //       iconCls: 'fa fa-expeditedssl',
    //       name: routeName.pageControl,
    //       component: pagePermissions,
    //       children: []
    //     },
    //     {
    //       path: '/btnPermissions',
    //       iconCls: 'fa fa-toggle-on',
    //       name: routeName.btnControl,
    //       component: btnPermissions,
    //       children: []
    //     }
    //   ]
    // },
    // {
    //   path: '/',
    //   iconCls: 'fa fa-newspaper-o',
    //   name: routeName.table,
    //   component: Layout,
    //   meta: {role: ['superAdmin']},
    //   children: [
    //     {
    //       path: '/dragTabe',
    //       iconCls: 'fa fa-hand-stop-o',
    //       name: routeName.dragSort,
    //       component: DragTable,
    //       children: []
    //     }
    //   ]
    // },

    // {
    //   path: '/',
    //   iconCls: 'fa fa-server',
    //   name: routeName.multiDirectory,
    //   component: Layout,
    //   children: [
    //     {
    //       path: '/erji1',
    //       iconCls: 'fa fa-server',
    //       name: routeName['menu2-1'],
    //       component: Erji,
    //       children: []
    //     },
    //     {
    //       path: '/erji2',
    //       iconCls: 'fa fa-server',
    //       name: routeName['menu2-2'],
    //       component: Erji2,
    //       children: []
    //     },
    //     {
    //       path: '/erji3',
    //       iconCls: 'fa fa-server',
    //       name: routeName['menu2-3'],
    //       component: CommonViews, // 无限极菜单的容器
    //       children: [
    //         {
    //           path: '/sanji1',
    //           iconCls: 'fa fa-server',
    //           name: routeName['menu3-1'],
    //           component: Sanji,
    //           children: []
    //         },
    //         {
    //           path: '/sanji2',
    //           iconCls: 'fa fa-server',
    //           name: routeName['menu3-2'],
    //           component: Sanji2,
    //           children: []
    //         },
    //         {
    //           path: '/sanji3',
    //           iconCls: 'fa fa-server',
    //           name: routeName['menu3-3'],
    //           component: CommonViews,
    //           children: [
    //             {
    //               path: '/siji',
    //               iconCls: 'fa fa-server',
    //               name: routeName['menu4-1'],
    //               component: Siji,
    //               children: []
    //             },
    //             {
    //               path: '/siji1',
    //               iconCls: 'fa fa-server',
    //               name: routeName['menu4-2'],
    //               component: CommonViews,
    //               children: [
    //                 {
    //                   path: '/wuji',
    //                   iconCls: 'fa fa-server',
    //                   name: routeName['menu5-1'],
    //                   component: Wuji,
    //                   children: []
    //                 }
    //               ]
    //             }
    //           ]
    //         }
    //       ]
    //     }
    //   ]
    // },
    // {
    //   path: '/',
    //   iconCls: 'fa fa-cloud-upload',
    //   name: routeName.upload,
    //   component: Layout,
    //   meta: {role: ['superAdmin']},
    //   children: [
    //     {
    //       path: '/upload',
    //       iconCls: 'fa fa-upload',
    //       name: routeName.fileUpload,
    //       component: Upload,
    //       children: []
    //     }
    //   ]
    // },
    {
        path: '/',
        iconCls: 'fa fa-pencil-square-o',
        name: routeName.editor,
        component: Layout,
        // meta: {role: ['superAdmin', 'admin']},
        children: [
            {
                path: '/editor',
                iconCls: 'fa fa-file-code-o',
                name: routeName.editor,
                component: editorView,
                children: []
            }
        ]
    },
    // {
    //   path: '/',
    //   iconCls: 'fa fa-cog',
    //   name: routeName.systemSettings,
    //   component: Layout,
    //   meta: {role: ['superAdmin']},
    //   children: [
    //     {
    //       path: '/navClassifies',
    //       iconCls: 'fa fa-th-list',
    //       name: routeName.navMenu,
    //       component: NavClassify,
    //       children: []
    //     }
    //   ]
    // },
    {path: '/:catchAll(.*)', redirect: '/404', hidden: true, children: []},
]

const router = createRouter({
    history: createWebHashHistory(),
    routes: defaultRouter,
})

export default router
export {defaultRouter, addRouter}
// import {import} from "element-plus";
